import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/page/ToastWidget.dart';

class RightClassWidget extends StatelessWidget {
  String title = "标题名称";
  List<String> classList = [];

  RightClassWidget({this.title, this.classList});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      //外边距
      margin: EdgeInsets.all(22),
      //内边距
      padding: EdgeInsets.all(12),
      //圆角边框
      decoration: BoxDecoration(
        color: Colors.white,
        //四个圆角的大小
        borderRadius: BorderRadius.all(Radius.circular(10)),
      ),
      //线性排列
      child: Column(
        //左对齐
        crossAxisAlignment: CrossAxisAlignment.start,
        //填充
        mainAxisSize: MainAxisSize.min,
        children: [
          Text(
            this.title,
            style: TextStyle(
              fontWeight: FontWeight.w600,
            ),
          ),
          ListView(
            shrinkWrap: true,
            children: [
              ...classList.map(
                (e) => ListTile(
                  title: Text("$e"),
                  onTap: () {
                    Toast.toast(context, msg: e);
                  },
                ),
              )
            ],
          )
        ],
      ),
    );
  }
}
